﻿using System;
using System.Linq;
using NUnit.Framework;
using ProjetoComperio.BusinessLogicLayer;
using ProjetoComperio.DataLayer.Entities;
using ProjetoComperio.Test.FakeData;

namespace ProjetoComperio.Test.BusinessLogicLayer
{
    [TestFixture]
    public class ProjectBLLTest
    {
        ProjectBLL projectBLL;

        [TestFixtureSetUp]
        public void TestFixtureSetUp()
        {
            projectBLL = new ProjectBLL();
        }

        [SetUp]
        public void SetUp()
        {
            projectBLL.InitializeDataContext(new FakeComperioEntitiesDataModel());
        }

        [Test]
        public void TestRetrieveProjects()
        {
            Assert.AreEqual(4, projectBLL.RetrieveProjects().Count());
        }

        [Test]
        public void TestCreateAndRetrieveProject()
        {
            projectBLL.Create(new Project() { ContributionID = 12332111, AcademicPersonID = 2, RegisterDate = DateTime.Now, SourceInfo = "si", Description = "dsc", Title = "title" });
            Assert.IsNotNull(projectBLL.RetrieveProject(12332111));
        }

    }
}
